﻿
'*******************************************************************
' Program: Data Center Visio Rack Tool
' Author: Albert E Edlund
' Date:
'
' Purpose:
'
'
'
'*******************************************************************


Imports Microsoft.Practices.EnterpriseLibrary.Common
Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
Imports Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging


Imports System
Imports System.ComponentModel
Imports System.Collections.Generic

Imports Microsoft.SqlServer.Types



Public Class dc_GeoData
    Implements INotifyPropertyChanged

#Region "Events"

    Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) _
        Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

    Private Sub OnPropertyChanged(ByVal info As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(info))
    End Sub

#End Region

#Region " Constructor "

    Public Sub New()
        initProperties()
    End Sub

    Public Sub New(ByVal strUserId As String)
        initProperties()
        Me.m_geoLastEdit = strUserId
    End Sub

#End Region

#Region " Properties and Fields "


    Private m_geoKey As Int32
    Const constGeoKey As Int32 = -1
    Public Property geoKey() As Int32
        Get
            Return Me.m_geoKey
        End Get
        Set(ByVal value As Int32)
            Me.m_geoKey = value
            Me.OnPropertyChanged("geoKey")
        End Set
    End Property

    Private m_geoSiteKey As Int32
    Const constGeoSiteKey As Int32 = -1
    Public Property geoSiteKey() As Int32
        Get
            Return Me.m_geoSiteKey
        End Get
        Set(ByVal value As Int32)
            Me.m_geoSiteKey = value
            Me.OnPropertyChanged("geoSiteKey")
        End Set
    End Property

    Private m_geoLocKey As Int32
    Const constGeoLocKey As Int32 = -1
    Public Property geoLocKey() As Int32
        Get
            Return Me.m_geoLocKey
        End Get
        Set(ByVal value As Int32)
            Me.m_geoLocKey = value
            Me.OnPropertyChanged("geoLocKey")
        End Set
    End Property

    Private m_geotxtSpatial As String
    Const constGeoTxtSpatial As String = ""
    Public Property geotxtSpatial() As String
        Get
            Return Me.m_geotxtSpatial
        End Get
        Set(ByVal value As String)
            Me.m_geotxtSpatial = value
            Me.OnPropertyChanged("geotxtSpatial")
        End Set
    End Property

    Private m_geoSpatial As Microsoft.SqlServer.Types.SqlGeography
    ' Const constGeoSpatial As Microsoft.SqlServer.Types.SqlGeography = Nothing
    Public Property geoSpatial() As Microsoft.SqlServer.Types.SqlGeography
        Get
            Return Me.m_geoSpatial
        End Get
        Set(ByVal value As Microsoft.SqlServer.Types.SqlGeography)
            Me.m_geoSpatial = CType(value, Microsoft.SqlServer.Types.SqlGeography)
            Me.OnPropertyChanged("geoSpatial")
        End Set
    End Property


    Private m_geoLatitude As Double
    Const constGeoLatitude As Double = 0
    Public Property geoLatitude As Double
        Get
            Return Me.m_geoLatitude
        End Get
        Set(ByVal value As Double)
            Me.m_geoLatitude = value
            Me.OnPropertyChanged("geoLatitude")
        End Set
    End Property


    Private m_geoLongitude As Double
    Const constGeoLongitude As Double = 0
    Public Property geoLongitude As Double
        Get
            Return Me.m_geoLongitude
        End Get
        Set(ByVal value As Double)
            Me.m_geoLongitude = value
            Me.OnPropertyChanged("geoLongitude")
        End Set
    End Property


    Private m_geoComments As String
    Const constgeoComments As String = ""
    Public Property geoComments() As String
        Get
            Return Me.m_geoComments
        End Get
        Set(ByVal value As String)
            Me.m_geoComments = value
            Me.OnPropertyChanged("geoComments")
        End Set
    End Property

    Private m_geoLastUpdate As Date
    Const constgeoLastUpdate As Date = #1/1/2001#
    Public Property geoLastUpdate() As Date
        Get
            Return Me.m_geoLastUpdate
        End Get
        Set(ByVal value As Date)
            Me.m_geoLastUpdate = value
            Me.OnPropertyChanged("geoUpdate")
        End Set
    End Property

    Private m_geoLastEdit As String
    Const constgeoLastEdit As String = "na"
    Public Property geoLastEdit() As String
        Get
            Return Me.m_geoLastEdit
        End Get
        Set(ByVal value As String)
            Me.m_geoLastEdit = value
            Me.OnPropertyChanged("geoLastEdit")
        End Set
    End Property


#End Region

#Region " Methods "


    Public Sub initProperties()

        Try


            geoKey = constGeoKey
            geoSiteKey = constGeoSiteKey
            geoLocKey = constGeoKey
            geoComments = constgeoComments
            geotxtSpatial = ""
            geoSpatial = Nothing
            geoLongitude = constGeoLongitude
            geoLatitude = constGeoLatitude
            geoLastUpdate = Now
            geoLastEdit = constgeoLastEdit



        Catch ex As Exception
            Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex, "Log Only Policy")
            If (rethrow) Then
                Throw
            End If
        End Try

    End Sub


#End Region




End Class
